package com.nip.irregularvebsdict.widgets;

import com.nip.irregularvebsdict.items.DateTimeItem;
import com.nip.irregularvebsdict.services.ServicesUtilities;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class IrregularVerbRandomReveice extends BroadcastReceiver {

	private Bundle bundle;
	private DateTimeItem dateTimeItem;

	@Override
	public void onReceive(Context arg0, Intent arg1) {

		if (arg1.getAction().equals(WidgetUtilities.WIDGET_UPDATE_TIME_ACTION)) {
			bundle = arg1.getExtras();
			if (bundle == null) {
				return;
			}

			dateTimeItem = (DateTimeItem) bundle
					.getSerializable(ServicesUtilities.UPDATE_TIME_KEY);
			IrregularVerbRandomWidget.update(arg0, dateTimeItem);
		} else if (arg1.getAction().equals(
				WidgetUtilities.WIDGET_UPDATE_WORD_ACTION)) {
			IrregularVerbRandomWidget.update(arg0);
		}

	}

}
